$(function(){
    $('div.detail a.close').click(function(){
	$('div.detail').hide();	
	return false;
    });
    
    $('div.content a.city').click(function(){
	var city = $(this).attr('data');
	Z.ajax({
	    url : Z.url('/client/records'),
	    data : {
		city : city,
		market : MARKET
	    },
	    success : function(data){
		if(data.length == 0){
		    return;
		}
		
		var html = [];
		$(data).each(function(i,item){
		    html.push('<h3>'+item.name+'</h3>');
		    html.push(item.content.replace(/\n/g,'<br/>'))
		});
		
		$('.client-list').html('<div>' + html.join('') + '</div>');
		
		$('div.detail').show();
		
		new Z.ScrollBox({
		    'target' : $('div.detail div.client-list div'),
		    'height' : 450,
		    'verticalBlockHeight' : 90,
		    'barWidth' : 10
		});
	    }
	});
	
	return false;
    });
});